require 'java'
include_class 'com.db4o.Db4o'

class DurableObject < java.lang.Object
	attr_accessor :name, :foo

	def initialize
		super
	end

	def to_s
		"name=#{@name} foo=#{@foo}"
	end
end


puts "test.rb: starting"
db = Db4o.openFile("database.db4o")
puts "got db instance db=#{db}"

s = DurableObject.new
s.name = "Test"
s.foo = "Bar"

puts "got durable object s=#{s}"

begin
	db.store(s)
rescue => e
	puts e.inspect
	puts e.backtrace
end

puts "Persisted"

